package com.lantosec.hmrp.modules.system.entity;

import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.system.vo.SysMenuVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

/**
 * <p>
 * 系统菜单表 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-02-12
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysMenu extends BaseEntity<SysMenuVO> {

    private static final long serialVersionUID = 1L;
    public SysMenu(SysMenuVO vo){
        this.menuId = vo.getMenuId();
        this.showName = vo.getShowName();
        this.menuName = vo.getMenuName();
        this.ico = vo.getIco();
        this.url = vo.getUrl();
        this.parentId = vo.getParentId();
        this.state = vo.getState();
        this.menuOrder = vo.getMenuOrder();
        this.ext = vo.getExt();
        this.flag = vo.getFlag();
    }

    @Override
    public SysMenuVO convertToVO(){
        return new SysMenuVO(this);
    }


    /**
     * 菜单ID
     */
    @TableId(value = "menu_id", type = IdType.ASSIGN_UUID)
    private String menuId;

    /**
     * 菜单显示名称
     */
    private String showName;

    /**
     * 菜单名称
     */
    private String menuName;

    /**
     * 菜单图标
     */
    private String ico;

    /**
     * 菜单路径
     */
    private String url;

    /**
     * 上级菜单ID
     */
    private String parentId;

    /**
     * 状态(0正常1废止)
     */
    private Integer state;

    /**
     * 排序
     */
    private Integer menuOrder;

    /**
     * 扩展字段
     */
    private String ext;

    /**
     * 是否删除
     */
    private Boolean flag;


    public enum ColName {
        menu_id, show_name, menu_name, ico, url, parent_id, state, menu_order, ext, flag,
    }
}
